from __future__ import annotations

from dataclasses import dataclass


@dataclass
class WinchSpec:
    required_line_pull_kN: float
    recommended_winch_t: float
    note: str


def select_winch(max_tension_kN: float, block_efficiency: float = 0.9, safety_factor: float = 1.25) -> WinchSpec:
    """牵引设备（绞磨/卷扬机）选型：按最大拉力/效率/安全系数。
    推荐吨位 = max_tension / (η) × SF / 9.81。
    """

    required = max_tension_kN / max(1e-6, block_efficiency) * safety_factor
    ton = required / 9.81
    return WinchSpec(required_line_pull_kN=required, recommended_winch_t=ton, note="向上取整选型")


